package com.example.finance_oa.controller;

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.read.builder.ExcelReaderBuilder;
import com.example.comment_oa.pojos.Budget;
import com.example.comment_oa.pojos_vo.AdditionalVo;
import com.example.comment_oa.pojos_vo.AdjustVo;
import com.example.comment_oa.response.AjaxResponse;
import com.example.finance_oa.dubbo.AccountListener;
import com.example.finance_oa.mapper.BudgetMapper;
import com.example.finance_oa.service.BudgetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.IOException;

@RestController
@CrossOrigin
@RequestMapping("/financeOa")
public class BudgetController {
@Autowired
    BudgetService budgetService;
@Autowired
    BudgetMapper budgetMapper;


    @RequestMapping("ysgl/allBudget")
    public AjaxResponse allBudget(@RequestBody Budget budget){

        return AjaxResponse.success(budgetService.allBudget(budget));
    }

    @RequestMapping("ysgl/allBudgetKm")
    public AjaxResponse allBudgetKm(){
        return AjaxResponse.success(budgetService.allBudgetKm());
    }

    @RequestMapping("ysgl/allXx")
    public AjaxResponse allXx(@RequestBody Budget budget){
        return  AjaxResponse.success(budgetService.allXx(budget));
    }


    @RequestMapping("ysgl/allBudgetBm")
    public AjaxResponse allBudetBm(){
        return AjaxResponse.success(budgetMapper.findAllByBudgetBm());
    }


    @RequestMapping("ysgl/updateBudget")
    public AjaxResponse updateBudget(@RequestBody AdditionalVo additionalVo){
        return AjaxResponse.success(budgetService.updateZjys(additionalVo));
    }
    //预算变更审核
    @RequestMapping("ysgl/BgBudget")
    public AjaxResponse bgBudget(@RequestBody AdjustVo adjustVo){
        return AjaxResponse.success(budgetService.updateBgys(adjustVo));
    }
    //根据年月查
    @RequestMapping("ysgl/selectYear/{year}/{month}")
    public  AjaxResponse selectYear(@PathVariable("year")String year,@PathVariable("month")String month){
        return AjaxResponse.success(budgetService.selectYear(year,month));
    }
}
